package cn.fl.ass.service.impl;

import java.util.List;

import cmm.mid.core.framework.page.Pager;
import fl.ass.facade.api.IAssFileLogApi;
import fl.ass.facade.condition.AssFileLogQC;
import fl.ass.facade.dto.AssFileLogDTO;
import fl.ass.facade.dto.MessageDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import cn.fl.ass.service.IAssFileLogService;
import cn.fl.ass.transform.AssFileLogVOTransform;
import cn.fl.ass.vo.AssFileLogVO;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;

/**
 * @Description: 转优车过户方案资料记录表 客户端服务层接口实现
 * @Description: 业务层方法名称前缀：新增：add* 删除：remove* 修改：modify* 查询对象：select* get* 批量：batch* 查询集合：search*
 */
@Service
public class AssFileLogServiceImpl implements IAssFileLogService {

	/**
	 * 日志
	 */
	private static final Logger logger = LoggerFactory.getLogger(IAssFileLogService.class);
	
	/**
	 * 转优车资料维护API
	 */
	@Autowired
	private IAssFileLogApi assFileLogApi;

	@Override
	public AssFileLogVO selectById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return null;
		}
		//TODO 业务逻辑
		MessageDTO<AssFileLogDTO> dto = assFileLogApi.findAssFileLogById(id);//this.自定义ApiService.selectById(id);
		return AssFileLogVOTransform.toVO(dto.getData());
	}

	@Override
	public Long add(AssFileLogVO entity) throws BaseException{
		if(null == entity){
			return null;
		}
		return this.assFileLogApi.saveAssFileLog(AssFileLogVOTransform.toDTO(entity)).getId();
	}

	@Override
	public boolean removeById(Long id) throws BaseException{
		if(StringUtils.isEmpty(id)){
			return false;
		}
		//return this.assFileLogApiService.removeById(id);
		//TODO 业务逻辑
		return false;
	}
	
	/**
     * 删除
     * @param ids
     * @return
     */
	@Override
    public boolean removeByIds(List<Long> ids)throws BaseException{
    	if(CollectionUtils.isEmpty(ids)){
			return false;
		};
		return false;
    }

	@Override
	public boolean modify(AssFileLogVO entity) throws BaseException{
		if(null == entity){
			return false;
		}
		return this.assFileLogApi.modifyAssFileLogCost(AssFileLogVOTransform.toDTO(entity)).isSuccess();
	}

	@Override
	public Pager searchListPage(Pager page) throws BaseException{
		if(null == page)page = new Pager();
		//return this.assFileLogApiService.searchListPage(page);
		//TODO 业务逻辑
		return null;
	}

    /**
     * 不分页查询所有
     * @param qc
     * @return
     * @throws BaseException
     */
    @Override
    public List<AssFileLogVO> selectList(AssFileLogQC qc) throws BaseException {
        return AssFileLogVOTransform.toVOList(assFileLogApi.selectList(qc).getDatas());
    }
}
